package iet.jxufe.cn.android.productanti_counterfeitingtraceabilitysystem;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.concurrent.CountDownLatch;

import iet.jxufe.cn.android.productanti_counterfeitingtraceabilitysystem.utils.SmsUtils;

@RunWith(AndroidJUnit4.class)
public class SmsTest {
    private CountDownLatch latch;

    @Before
    public void setUp() {
        latch = new CountDownLatch(1);
    }

    @Test
    public void testSmsMock() throws InterruptedException {
        String phoneNumber = "1234567890";
        String message = "Hello, this is a test message.";

        new SmsUtils.SmsTask() {
            @Override
            protected void onPostExecute(String result) {
                super.onPostExecute(result);

                latch.countDown();
            }
        }.execute(phoneNumber, message);

        latch.await();
    }
}
